<!-- 新增见证任务 -->
<template>
  <div class="witness-body">
    <breadcrumb
      :breadPathList="breadPathList"
      lastBreadTitle="新增见证任务"
      :showBackBtnFlag="true"
      @handleBack="handleBack"
    />
    <div class="witness-main">
      <div class="main-body">
        <el-form
          ref="projectForm"
          grid
          :model="projectForm"
          label-width="135px"
          class="ui-ml10 ui-mr10"
          :rules="projectRules"
          :disabled="haveSavedFlag"
        >
          <el-collapse v-model="activeNames" icon-text card>
            <el-collapse-item title="项目信息" name="1">
              <el-form-item :span="12" label="项目名称" prop="projectName">
                <el-input v-model="projectForm.projectName" placeholder="请输入" maxlength="600" />
              </el-form-item>
              <el-form-item :span="12" label="项目编号" prop="projectCode">
                <el-input v-model="projectForm.projectCode" placeholder="请输入" maxlength="20" />
              </el-form-item>

              <div v-for="(item, key) in projectForm.bidSectionInfoList" :key="key" class="bid-content">
                <el-form-item
                  :key="key"
                  :span="12"
                  label="标段名称"
                  :prop="`bidSectionInfoList.${key}.bidSectionName`"
                  :rules="projectRules.bidSectionName"
                  label-width="125px"
                >
                  <el-input v-model="item.bidSectionName" placeholder="请输入" maxlength="500" />
                </el-form-item>
                <el-form-item
                  :span="12"
                  label="标段编号"
                  :prop="`bidSectionInfoList.${key}.bidSectionCode`"
                  :rules="projectRules.bidSectionCode"
                  label-width="135px"
                  class="bid-code"
                >
                  <el-input v-model="item.bidSectionCode" placeholder="请输入" maxlength="23" />
                  <el-button type="text" icon="el-icon-delete" class="del-bid" @click="handleDelBidFn(key)" />
                </el-form-item>
              </div>

              <div class="font-right ui-mb10 ui-mr10">
                <el-button type="primary" icon="icon-xinzengsvg1" plain @click="handleAddBidFn()"> 新增标段</el-button>
              </div>
            </el-collapse-item>
            <el-collapse-item title="基本信息" name="2">
              <el-form-item :span="12" label="项目来源" prop="sourceSystemName">
                <el-input v-model="projectForm.sourceSystemName" placeholder="请输入" maxlength="200" disabled />
              </el-form-item>
              <el-form-item :span="12" label="行业类别" prop="industryArr">
                <el-cascader
                  v-model="projectForm.industryArr"
                  class="ui-w"
                  :options="industryArrOptionsList"
                  @change="industryArrChangeFn"
                />
              </el-form-item>
              <el-form-item :span="12" label="交易方式" prop="tenderMode">
                <el-select
                  v-model="projectForm.tenderMode"
                  class="ui-w"
                  placeholder="请选择"
                  :disabled="projectForm.industryArr.length === 0"
                  @change="tenderModeChangeFn"
                >
                  <el-option
                    v-for="(item, key) in tenderModeOptionsObj"
                    :key="key"
                    :label="item.label"
                    :value="item.value"
                  />
                </el-select>
              </el-form-item>
              <el-form-item :span="12" label="资审方式" prop="qualificationExamMethod">
                <el-select
                  v-model="projectForm.qualificationExamMethod"
                  :disabled="!projectForm.tenderMode"
                  class="ui-w"
                  placeholder="请选择"
                >
                  <el-option
                    v-for="item in qualificationExamMethods"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  />
                  <!-- <el-option
                    v-for="item in TASKOBJ.qualificationExamMethods"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  /> -->
                </el-select>
              </el-form-item>
              <el-form-item :span="12" label="是否电子标" prop="electronFlag">
                <el-radio-group v-model="projectForm.electronFlag">
                  <el-radio v-for="item in TASKOBJ.ifTypeEnum" :key="item.value" :label="item.value">
                    {{ item.label }}
                  </el-radio>
                </el-radio-group>
              </el-form-item>
              <el-form-item :span="12" label="监管部门" prop="regulateUnit">
                <el-input v-model="projectForm.regulateUnit" placeholder="请输入" maxlength="200" />
              </el-form-item>
              <div class="el-col el-col-24">
                <el-form-item :span="24" label="招标单位" prop="tendererName">
                  <el-input v-model="projectForm.tendererName" placeholder="请输入" maxlength="200" />
                </el-form-item>
              </div>
              <el-form-item :span="12" label="招标单位联系人" prop="tendererUserName">
                <el-input v-model="projectForm.tendererUserName" placeholder="请输入" maxlength="100" />
              </el-form-item>
              <el-form-item :span="12" label="联系电话" prop="tendererContact">
                <el-input v-model="projectForm.tendererContact" placeholder="请输入" maxlength="100" />
              </el-form-item>
              <div class="el-col el-col-24">
                <el-form-item :span="24" label="代理机构" prop="tenderAgencyName">
                  <el-input v-model="projectForm.tenderAgencyName" placeholder="请输入" maxlength="200" />
                </el-form-item>
              </div>
              <el-form-item :span="12" label="代理机构联系人" prop="tenderAgencyUserName">
                <el-input v-model="projectForm.tenderAgencyUserName" placeholder="请输入" maxlength="100" />
              </el-form-item>
              <el-form-item :span="12" label="联系电话" prop="tenderAgencyContact">
                <el-input v-model="projectForm.tenderAgencyContact" placeholder="请输入" maxlength="100" />
              </el-form-item>
              <div class="el-col el-col-24">
                <el-form-item :span="24" label="业务部门">
                  <el-input v-model="projectForm.businessUnit" placeholder="请输入" maxlength="200" />
                </el-form-item>
              </div>
              <el-form-item :span="12" label="经办人" prop="operateUserName">
                <el-input v-model="projectForm.operateUserName" placeholder="请输入" maxlength="100" />
              </el-form-item>
              <el-form-item :span="12" label="联系电话">
                <el-input v-model="projectForm.operateUserContact" placeholder="请输入" maxlength="100" />
              </el-form-item>
              <!-- <div class="el-col el-col-24">
                <el-form-item :span="12" label="远程评标发起方">
                  <el-input v-model="projectForm.remoteOriginator" placeholder="请输入" maxlength="200" />
                </el-form-item>
              </div>
              <el-form-item :span="12" label="远程评标联系人">
                <el-input v-model="projectForm.remoteUserName" placeholder="请输入" maxlength="100" />
              </el-form-item>
              <el-form-item :span="12" label="联系电话">
                <el-input v-model="projectForm.remoteContact" placeholder="请输入" maxlength="100" />
              </el-form-item> -->
            </el-collapse-item>
            <el-collapse-item title="预约信息" name="3">
              <!-- <el-form-item label="预约是否区分标段">
                <el-radio-group
                  v-model="projectForm.reserveByBidSectionFlag"
                  :disabled="projectForm.bidSectionInfoList.length === 0"
                >
                  <el-radio :label="true"> 是 </el-radio>
                  <el-radio :label="false"> 否 </el-radio>
                </el-radio-group>
              </el-form-item> -->
              <el-form-item label="预约模式">
                <el-radio-group
                  v-model="projectForm.witnessForm"
                  :disabled="projectForm.bidSectionInfoList.length === 0"
                >
                  <el-radio label="BID"> 按标段预约</el-radio>
                  <el-radio label="PROJ"> 按项目预约</el-radio>
                </el-radio-group>
              </el-form-item>
              <div v-if="projectForm.witnessForm === 'BID'">
                <div v-for="(item, key) in projectForm.reserveByBidList" :key="key">
                  <div class="el-col el-col-24 ui-title ui-pl30">
                    {{ projectForm.bidSectionInfoList[key].bidSectionName || "标段名称" }}
                  </div>
                  <!-- {{ item }} -->
                  <template v-if="projectForm.qualificationExamMethod === 'PRE_QUALIFICATION'">
                    <el-form-item
                      :span="12"
                      label="资格预审开标时间"
                      :prop="`reserveByBidList[${key}].preBidOpenTime`"
                      :rules="projectRules.preBidOpenTime"
                    >
                      <el-date-picker
                        v-model="item.preBidOpenTime"
                        type="datetimerange"
                        range-separator="至"
                        start-placeholder="开始日期"
                        end-placeholder="结束日期"
                        format="yyyy-MM-dd HH:mm"
                        value-format="yyyy-MM-dd HH:mm:ss"
                        class="ui-w"
                      />
                    </el-form-item>
                    <el-form-item :span="12" label="资格预审开标地点">
                      <el-input v-model="item.preBidOpenAddress" placeholder="请输入" maxlength="200" />
                    </el-form-item>
                    <el-form-item
                      :span="12"
                      label="资格预审评标时间"
                      :prop="`reserveByBidList[${key}].preEvaluationTime`"
                      :rules="projectRules.preEvaluationTime"
                    >
                      <el-date-picker
                        v-model="item.preEvaluationTime"
                        type="datetimerange"
                        range-separator="至"
                        start-placeholder="开始日期"
                        end-placeholder="结束日期"
                        format="yyyy-MM-dd HH:mm"
                        value-format="yyyy-MM-dd HH:mm:ss"
                        class="ui-w"
                      />
                    </el-form-item>
                    <el-form-item :span="12" label="资格预审评标地点">
                      <el-input v-model="item.preEvaluationAddress" placeholder="请输入" maxlength="200" />
                    </el-form-item>
                  </template>
                  <el-form-item
                    :span="12"
                    label="开标时间"
                    :prop="`reserveByBidList.${key}.openTime`"
                    :rules="projectRules.openTime"
                  >
                    <el-date-picker
                      v-model="item.openTime"
                      type="datetimerange"
                      range-separator="至"
                      start-placeholder="开始日期"
                      end-placeholder="结束日期"
                      format="yyyy-MM-dd HH:mm"
                      value-format="yyyy-MM-dd HH:mm:ss"
                      class="ui-w"
                    />
                  </el-form-item>
                  <el-form-item
                    :span="12"
                    label="开标地点"
                    :prop="`reserveByBidList.${key}.openAddress`"
                    :rules="projectRules.openAddress"
                  >
                    <el-input v-model="item.openAddress" placeholder="请输入" maxlength="200">
                      <template slot="append">
                        <el-button
                          v-if="isShowSelectAddressButton('KB', key)"
                          type="primary"
                          class="select-address-button"
                          @click="showGZSelectAddress(`projectForm.reserveByBidList.${key}.openAddress`)"
                        >
                          预约场地
                        </el-button>
                      </template>
                    </el-input>
                  </el-form-item>
                  <el-form-item
                    :span="12"
                    label="评标时间"
                    :prop="`reserveByBidList.${key}.evaluationTime`"
                    :rules="projectRules.evaluationTime"
                  >
                    <el-date-picker
                      v-model="item.evaluationTime"
                      type="datetimerange"
                      range-separator="至"
                      start-placeholder="开始日期"
                      end-placeholder="结束日期"
                      format="yyyy-MM-dd HH:mm"
                      value-format="yyyy-MM-dd HH:mm:ss"
                      class="ui-w"
                    />
                  </el-form-item>
                  <el-form-item
                    :span="12"
                    label="评标地点"
                    :prop="`reserveByBidList.${key}.evaluationAddress`"
                    :rules="projectRules.evaluationAddress"
                  >
                    <el-input v-model="item.evaluationAddress" placeholder="请输入" maxlength="200">
                      <template slot="append">
                        <el-button
                          v-if="isShowSelectAddressButton('PB', key)"
                          type="primary"
                          class="select-address-button"
                          @click="showGZSelectAddress(`projectForm.reserveByBidList.${key}.evaluationAddress`)"
                        >
                          预约场地
                        </el-button>
                      </template>
                    </el-input>
                  </el-form-item>
                  <!-- ********* 改造开始 -->
                  <el-form-item :span="12" label="是否隔夜标" prop="overNightFlag">
                    <el-radio-group v-model="item.overNightFlag">
                      <el-radio v-for="item in TASKOBJ.ifTypeEnum" :key="item.value" :label="item.value">
                        {{ item.label }}
                      </el-radio>
                    </el-radio-group>
                  </el-form-item>
                  <el-form-item :span="12" label="是否远程开标" prop="remoteOpenFlag">
                    <el-radio-group v-model="item.remoteOpenFlag">
                      <el-radio v-for="item in TASKOBJ.ifTypeEnum" :key="item.value" :label="item.value">
                        {{ item.label }}
                      </el-radio>
                    </el-radio-group>
                  </el-form-item>
                  <el-form-item :span="12" label="是否重新招标" prop="tenderAgainFlag">
                    <el-radio-group v-model="item.tenderAgainFlag">
                      <el-radio v-for="item in TASKOBJ.ifTypeEnum" :key="item.value" :label="item.value">
                        {{ item.label }}
                      </el-radio>
                    </el-radio-group>
                  </el-form-item>
                  <el-form-item :span="24" label="是否清标" required>
                    <el-radio-group v-model="item.preClearFlag">
                      <el-radio v-for="item in TASKOBJ.ifTypeEnum" :key="item.value" :label="item.value">
                        {{ item.label }}
                      </el-radio>
                    </el-radio-group>
                  </el-form-item>
                  <template v-if="item.preClearFlag === 'Y'">
                    <el-form-item
                      :span="12"
                      label="清标时间"
                      :rules="projectRules.preClearTime"
                      :prop="`reserveByBidList.${key}.preClearTime`"
                    >
                      <el-date-picker
                        v-model="item.preClearTime"
                        type="datetimerange"
                        range-separator="至"
                        start-placeholder="开始日期"
                        end-placeholder="结束日期"
                        format="yyyy-MM-dd HH:mm"
                        value-format="yyyy-MM-dd HH:mm:ss"
                        class="ui-w"
                      />
                    </el-form-item>
                    <!--
                      :prop="`reserveByProjectObj.${key}.preClearAddress`"
                      :rules="projectRules.preClearAddress" -->
                    <el-form-item :span="12" label="清标地点">
                      <el-input v-model="item.preClearAddress" placeholder="请输入" maxlength="200" />
                    </el-form-item>
                  </template>

                  <el-form-item :span="12" label="是否远程评标" prop="remoteEvaluationFlag">
                    <el-radio-group v-model="item.remoteEvaluationFlag">
                      <el-radio v-for="item in TASKOBJ.ifTypeEnum" :key="item.value" :label="item.value">
                        {{ item.label }}
                      </el-radio>
                    </el-radio-group>
                  </el-form-item>
                  <el-form-item v-if="item.remoteEvaluationFlag === 'Y'" :span="12" label="是否主场" prop="homeFlag">
                    <el-radio-group v-model="item.homeFlag">
                      <el-radio v-for="item in TASKOBJ.ifTypeEnum" :key="item.value" :label="item.value">
                        {{ item.label }}
                      </el-radio>
                    </el-radio-group>
                  </el-form-item>
                  <!-- :rules="projectRules.remoteOriginator" -->
                  <template v-if="item.remoteEvaluationFlag === 'Y'">
                    <el-form-item :span="24" label="远程异地发起方" prop="reserveByProjectObj.remoteOriginator">
                      <el-input v-model="item.remoteOriginator" placeholder="请输入" maxlength="200" />
                    </el-form-item>

                    <el-form-item :span="12" label="远程异地联系人">
                      <el-input v-model="item.remoteUserName" placeholder="请输入" maxlength="100" />
                    </el-form-item>
                    <el-form-item :span="12" label="远程异地联系电话">
                      <el-input v-model="item.remoteContact" placeholder="请输入" maxlength="100" />
                    </el-form-item>
                  </template>
                </div>
              </div>
              <div v-else>
                <!-- {{ projectForm.qualificationExamMethod }} -->
                <template v-if="projectForm.qualificationExamMethod === 'PRE_QUALIFICATION'">
                  <el-form-item
                    :span="12"
                    label="资格预审开标时间"
                    prop="reserveByProjectObj.preBidOpenTime"
                    :rules="projectRules.preBidOpenTime"
                  >
                    <el-date-picker
                      v-model="projectForm.reserveByProjectObj.preBidOpenTime"
                      type="datetimerange"
                      range-separator="至"
                      start-placeholder="开始日期"
                      end-placeholder="结束日期"
                      format="yyyy-MM-dd HH:mm"
                      value-format="yyyy-MM-dd HH:mm:ss"
                      class="ui-w"
                    />
                  </el-form-item>
                  <el-form-item
                    :span="12"
                    label="资格预审开标地点"
                    prop="reserveByProjectObj.preBidOpenAddress"
                    :rules="projectRules.preBidOpenAddress"
                  >
                    <el-input
                      v-model="projectForm.reserveByProjectObj.preBidOpenAddress"
                      placeholder="请输入"
                      maxlength="200"
                    />
                  </el-form-item>
                  <el-form-item
                    :span="12"
                    label="资格预审评标时间"
                    prop="reserveByProjectObj.preEvaluationTime"
                    :rules="projectRules.preEvaluationTime"
                  >
                    <el-date-picker
                      v-model="projectForm.reserveByProjectObj.preEvaluationTime"
                      type="datetimerange"
                      range-separator="至"
                      start-placeholder="开始日期"
                      end-placeholder="结束日期"
                      format="yyyy-MM-dd HH:mm"
                      value-format="yyyy-MM-dd HH:mm:ss"
                      class="ui-w"
                    />
                  </el-form-item>
                  <el-form-item
                    :span="12"
                    label="资格预审评标地点"
                    prop="reserveByProjectObj.preEvaluationAddress"
                    :rules="projectRules.preEvaluationAddress"
                  >
                    <el-input
                      v-model="projectForm.reserveByProjectObj.preEvaluationAddress"
                      placeholder="请输入"
                      maxlength="200"
                    />
                  </el-form-item>
                </template>
                <el-form-item
                  :span="12"
                  label="开标时间"
                  prop="reserveByProjectObj.openTime"
                  :rules="projectRules.openTime"
                >
                  <el-date-picker
                    v-model="projectForm.reserveByProjectObj.openTime"
                    type="datetimerange"
                    range-separator="至"
                    start-placeholder="开始日期"
                    end-placeholder="结束日期"
                    format="yyyy-MM-dd HH:mm"
                    value-format="yyyy-MM-dd HH:mm:ss"
                    class="ui-w"
                  />
                </el-form-item>
                <el-form-item
                  :span="12"
                  label="开标地点"
                  prop="reserveByProjectObj.openAddress"
                  :rules="projectRules.openAddress"
                >
                  <el-input v-model="projectForm.reserveByProjectObj.openAddress" placeholder="请输入" maxlength="200">
                    <template slot="append">
                      <el-button
                        v-if="isShowSelectAddressButton('KB')"
                        type="primary"
                        class="select-address-button"
                        @click="showGZSelectAddress('projectForm.reserveByProjectObj.openAddress')"
                      >
                        预约场地
                      </el-button>
                    </template>
                  </el-input>
                </el-form-item>
                <el-form-item
                  :span="12"
                  label="评标时间"
                  prop="reserveByProjectObj.evaluationTime"
                  :rules="projectRules.evaluationTime"
                >
                  <el-date-picker
                    v-model="projectForm.reserveByProjectObj.evaluationTime"
                    type="datetimerange"
                    range-separator="至"
                    start-placeholder="开始日期"
                    end-placeholder="结束日期"
                    format="yyyy-MM-dd HH:mm"
                    value-format="yyyy-MM-dd HH:mm:ss"
                    class="ui-w"
                  />
                </el-form-item>
                <el-form-item
                  :span="12"
                  label="评标地点"
                  prop="reserveByProjectObj.evaluationAddress"
                  :rules="projectRules.evaluationAddress"
                >
                  <el-input
                    v-model="projectForm.reserveByProjectObj.evaluationAddress"
                    placeholder="请输入"
                    maxlength="200"
                  >
                    <template slot="append">
                      <el-button v-if="isShowSelectAddressButton('PB')" type="primary" class="select-address-button"
                                 @click="showGZSelectAddress('projectForm.reserveByProjectObj.evaluationAddress')">
                        预约场地
                      </el-button>
                    </template>
                  </el-input>
                </el-form-item>
                <!--
            tenderAgainFlag: "N", // 是否重新招标标识，Y=是，N=否
            overNightFlag: "N", // 是否隔夜，Y=隔夜，N=非隔夜
            remoteOpenFlag: "N", // 是否远程开标，Y=远程开标，N=非远程开标
            remoteEvaluationFlag: "N", // 是否远程评标，Y=远程评标，N=非远程评标
            homeFlag: "N", // 是否主场，Y=是，N=否
            remoteOriginator: "", // 远程异地发起方
            remoteUserName: "", // 远程异地联系人
            remoteContact: "", // 远程异地联系方式
            preClearFlag: "", // 是否清标，Y=远程开标，N=非远程开标
            sourceObjectId: "" //   来源对象id，用于防止网络异常导致重复创建见证任务 -->
                <el-form-item :span="12" label="是否隔夜标" prop="overNightFlag">
                  <el-radio-group v-model="projectForm.reserveByProjectObj.overNightFlag">
                    <el-radio v-for="item in TASKOBJ.ifTypeEnum" :key="item.value" :label="item.value">
                      {{ item.label }}
                    </el-radio>
                  </el-radio-group>
                </el-form-item>
                <el-form-item :span="12" label="是否远程开标" prop="remoteOpenFlag">
                  <el-radio-group v-model="projectForm.reserveByProjectObj.remoteOpenFlag">
                    <el-radio v-for="item in TASKOBJ.ifTypeEnum" :key="item.value" :label="item.value">
                      {{ item.label }}
                    </el-radio>
                  </el-radio-group>
                </el-form-item>
                <el-form-item :span="12" label="是否重新招标" prop="tenderAgainFlag">
                  <el-radio-group v-model="projectForm.reserveByProjectObj.tenderAgainFlag">
                    <el-radio v-for="item in TASKOBJ.ifTypeEnum" :key="item.value" :label="item.value">
                      {{ item.label }}
                    </el-radio>
                  </el-radio-group>
                </el-form-item>
                <el-form-item :span="24" label="是否清标" required>
                  <el-radio-group v-model="projectForm.reserveByProjectObj.preClearFlag">
                    <el-radio v-for="item in TASKOBJ.ifTypeEnum" :key="item.value" :label="item.value">
                      {{ item.label }}
                    </el-radio>
                  </el-radio-group>
                </el-form-item>
                <template v-if="projectForm.reserveByProjectObj.preClearFlag == 'Y'">
                  <el-form-item
                    :span="12"
                    label="清标时间"
                    :rules="projectRules.preClearTime"
                    prop="reserveByProjectObj.preClearTime"
                  >
                    <el-date-picker
                      v-model="projectForm.reserveByProjectObj.preClearTime"
                      type="datetimerange"
                      range-separator="至"
                      start-placeholder="开始日期"
                      end-placeholder="结束日期"
                      format="yyyy-MM-dd HH:mm"
                      value-format="yyyy-MM-dd HH:mm:ss"
                      class="ui-w"
                    />
                  </el-form-item>
                  <el-form-item
                    :span="12"
                    label="清标地点"
                    prop="reserveByProjectObj.preClearAddress"
                    :rules="projectRules.preClearAddress"
                  >
                    <el-input
                      v-model="projectForm.reserveByProjectObj.preClearAddress"
                      placeholder="请输入"
                      maxlength="200"
                    />
                  </el-form-item>
                </template>

                <el-form-item :span="12" label="是否远程评标" prop="remoteEvaluationFlag">
                  <el-radio-group v-model="projectForm.reserveByProjectObj.remoteEvaluationFlag">
                    <el-radio v-for="item in TASKOBJ.ifTypeEnum" :key="item.value" :label="item.value">
                      {{ item.label }}
                    </el-radio>
                  </el-radio-group>
                </el-form-item>
                <el-form-item
                  v-if="projectForm.reserveByProjectObj.remoteEvaluationFlag === 'Y'"
                  :span="12"
                  label="是否主场"
                  prop="homeFlag"
                >
                  <el-radio-group v-model="projectForm.reserveByProjectObj.homeFlag">
                    <el-radio v-for="item in TASKOBJ.ifTypeEnum" :key="item.value" :label="item.value">
                      {{ item.label }}
                    </el-radio>
                  </el-radio-group>
                </el-form-item>
                <!-- :rules="projectRules.remoteOriginator" -->
                <template v-if="projectForm.reserveByProjectObj.remoteEvaluationFlag === 'Y'">
                  <el-form-item :span="24" label="远程异地发起方" prop="reserveByProjectObj.remoteOriginator">
                    <el-input
                      v-model="projectForm.reserveByProjectObj.remoteOriginator"
                      placeholder="请输入"
                      maxlength="200"
                    />
                  </el-form-item>

                  <el-form-item :span="12" label="远程异地联系人">
                    <el-input
                      v-model="projectForm.reserveByProjectObj.remoteUserName"
                      placeholder="请输入"
                      maxlength="100"
                    />
                  </el-form-item>
                  <el-form-item :span="12" label="远程异地联系电话">
                    <el-input
                      v-model="projectForm.reserveByProjectObj.remoteContact"
                      placeholder="请输入"
                      maxlength="100"
                    />
                  </el-form-item>
                </template>
              </div>
            </el-collapse-item>
          </el-collapse>
        </el-form>
      </div>
      <div v-if="!haveSavedFlag" class="main-footer">
        <el-button type="primary" :loading="saveLoading" @click="handleSaveFn()"> 保存</el-button>
      </div>
    </div>

    <!-- 选择场地的弹框 -->
    <gzSelectAddress ref="selectAddressDialog" @update="setStandardRoomId" />
  </div>
</template>

<script>
// 这里可以导入其他文件（比如：组件，工具js，第三方插件js，json文件，图片文件等等）
import { moduleInit, defaultystemCode, taskCreate } from "@/api/api";
import gzSelectAddress from "./components/gz-select-address";

export default {
  // 引入组件
  components: {
    gzSelectAddress
  },
  props: {},
  data() {
    // 这里存放数据
    return {
      showSelectAddressDialog: false,

      breadPathList: [
        {
          path: "/WitnessTaskManagement/WitnessTaskView",
          title: "见证任务管理"
        }
      ],
      activeNames: ["1", "2", "3"], // 折叠面板默认全部展开
      TASKOBJ: {}, // 后端返回的所有下拉映射值数据
      industryArrOptionsList: [], // 行业类别下拉
      tenderModeIndustryObj: {}, // 依据行业类别[一级菜单---二级菜单]分组显示的交易方式
      tenderModeOptionsObj: {}, // 交易方式下拉
      qualificationExamMethods: [], // 资审方式
      projectForm: {
        projectName: "",
        projectCode: "",
        bidSectionInfoList: [], // 标段列表
        sourceSystemName: "",
        systemCode: "", // 系统编码
        industryArr: [],
        tenderMode: "",
        qualificationExamMethod: "",
        electronFlag: "Y",
        overNightFlag: "N",
        remoteOpenFlag: "N",
        remoteEvaluationFlag: "N",
        tenderAgainFlag: "N",
        regulateUnit: "",
        tendererName: "",
        tendererUserName: "",
        tendererContact: "",
        tenderAgencyName: "",
        tenderAgencyUserName: "",
        tenderAgencyContact: "",
        businessUnit: "",
        operateUserName: "",
        operateUserContact: "",
        // remoteOriginator: "remoteOriginator",
        // remoteUserName: "remoteUserName",
        // remoteContact: "remoteContact",
        // preBidOpenTime: [],
        // preBidOpenAddress: "preBidOpenAddress",
        // preEvaluationTime: [],
        // preEvaluationAddress: "preEvaluationAddress",
        // reserveByBidSectionFlag: false, // 预约是否区分标段，默认：否
        witnessForm: "PROJ", // 预约是否区分标段，默认：否
        reserveByProjectObj: {
          preBidOpenTime: [],
          preBidOpenAddress: "",
          preEvaluationTime: [],
          preEvaluationAddress: "",
          openTime: [], // 开标时间
          openAddress: "", // 开标地点
          evaluationTime: [], // 评标时间
          evaluationAddress: "", // 评标地点
          preClearTime: [], // 清标时间
          preClearAddress: "", // 清标地点
          tenderAgainFlag: "N", // 是否重新招标标识，Y=是，N=否
          overNightFlag: "N", // 是否隔夜，Y=隔夜，N=非隔夜
          remoteOpenFlag: "N", // 是否远程开标，Y=远程开标，N=非远程开标
          remoteEvaluationFlag: "N", // 是否远程评标，Y=远程评标，N=非远程评标
          homeFlag: "N", // 是否主场，Y=是，N=否
          remoteOriginator: "", // 远程异地发起方
          remoteUserName: "", // 远程异地联系人
          remoteContact: "", // 远程异地联系方式
          preClearFlag: "N", // 是否清标，Y=远程开标，N=非远程开标
          sourceObjectId: "" //   来源对象id，用于防止网络异常导致重复创建见证任务
        }, // 按照项目预约的预约信息对象（该项目所有标段共用）
        reserveByBidList: [] // 按照标段预约的预约信息数组（每个标段都有自己的预约信息）
      },
      projectForm_dev: {
        projectName: new Date().getTime() || "",
        projectCode: new Date().getTime() || "",
        bidSectionInfoList: [], // 标段列表
        sourceSystemName: "",
        systemCode: "", // 系统编码
        industryArr: [],
        tenderMode: "",
        qualificationExamMethod: "",
        electronFlag: "Y",
        overNightFlag: "N",
        remoteOpenFlag: "N",
        remoteEvaluationFlag: "N",
        tenderAgainFlag: "N",
        regulateUnit: "regulateUnit",
        tendererName: "1213123",
        tendererUserName: "123123",
        tendererContact: "tendererContact",
        tenderAgencyName: "tenderAgencyName",
        tenderAgencyUserName: "tenderAgencyUserName",
        tenderAgencyContact: "tenderAgencyContact",
        businessUnit: "businessUnit",
        operateUserName: "operateUserName",
        operateUserContact: "operateUserContact",
        // remoteOriginator: "remoteOriginator",
        // remoteUserName: "remoteUserName",
        // remoteContact: "remoteContact",
        // preBidOpenTime: [],
        // preBidOpenAddress: "preBidOpenAddress",
        // preEvaluationTime: [],
        // preEvaluationAddress: "preEvaluationAddress",
        // reserveByBidSectionFlag: false, // 预约是否区分标段，默认：否
        witnessForm: "PROJ", // 预约是否区分标段，默认：否
        reserveByProjectObj: {
          preBidOpenTime: [],
          preBidOpenAddress: "preBidOpenAddress",
          preEvaluationTime: [],
          preEvaluationAddress: "preEvaluationAddress",
          openTime: [], // 开标时间
          openAddress: "openAddress", // 开标地点
          evaluationTime: [], // 评标时间
          evaluationAddress: "evaluationAddress", // 评标地点
          preClearTime: [], // 清标时间
          preClearAddress: "preClearAddress", // 清标地点
          tenderAgainFlag: "N", // 是否重新招标标识，Y=是，N=否
          overNightFlag: "N", // 是否隔夜，Y=隔夜，N=非隔夜
          remoteOpenFlag: "N", // 是否远程开标，Y=远程开标，N=非远程开标
          remoteEvaluationFlag: "N", // 是否远程评标，Y=远程评标，N=非远程评标
          homeFlag: "N", // 是否主场，Y=是，N=否
          remoteOriginator: "remoteOriginator", // 远程异地发起方
          remoteUserName: "remoteUserName", // 远程异地联系人
          remoteContact: "remoteUserName", // 远程异地联系方式
          preClearFlag: "N", // 是否清标，Y=远程开标，N=非远程开标
          sourceObjectId: "" //   来源对象id，用于防止网络异常导致重复创建见证任务
        }, // 按照项目预约的预约信息对象（该项目所有标段共用）
        reserveByBidList: [] // 按照标段预约的预约信息数组（每个标段都有自己的预约信息）
      },
      reserveByProjectObjOld: {}, // 添加标段默认数据
      projectFormOld: {}, // 缓存默认数据

      projectRules: {
        projectName: [{ required: true, message: "请输入项目名称", trigger: "blur" }],
        projectCode: [{ required: true, message: "请输入项目编号", trigger: "blur" }],
        bidSectionName: [{ required: true, message: "请输入标段名称", trigger: "blur" }],
        bidSectionCode: [{ required: true, message: "请输入标段编号", trigger: "blur" }],
        sourceSystemName: [{ required: true, message: "请输入项目来源", trigger: "blur" }],
        industryArr: [{ required: true, message: "请选择行业类别", trigger: "change" }],
        tenderMode: [{ required: true, message: "请选择交易方式", trigger: "change" }],
        qualificationExamMethod: [{ required: true, message: "请选择资审方式", trigger: "change" }],
        electronFlag: [{ required: true, message: "请选择是否电子标", trigger: "change" }],
        overNightFlag: [{ required: true, message: "请选择是否隔夜标", trigger: "change" }],
        remoteOpenFlag: [{ required: true, message: "请选择是否远程开标", trigger: "change" }],
        remoteEvaluationFlag: [{ required: true, message: "请选择是否远程评标", trigger: "change" }],
        tenderAgainFlag: [{ required: true, message: "请选择是否重新招标", trigger: "change" }],
        regulateUnit: [{ required: true, message: "请输入监管部门", trigger: "blur" }],
        tendererName: [{ required: true, message: "请输入招标单位", trigger: "blur" }],
        tendererUserName: [{ required: true, message: "请输入招标单位联系人", trigger: "blur" }],
        tendererContact: [{ required: true, message: "请输入招标单位联系电话", trigger: "blur" }],
        tenderAgencyName: [{ required: true, message: "请输入代理机构", trigger: "blur" }],
        tenderAgencyUserName: [{ required: true, message: "请输入代理机构联系人", trigger: "blur" }],
        tenderAgencyContact: [{ required: true, message: "请输入代理机构联系电话", trigger: "blur" }],
        operateUserName: [{ required: true, message: "请输入经办人", trigger: "blur" }],
        openTime: [{ required: true, message: "请选择开标时间", trigger: "change" }],
        openAddress: [{ required: true, message: "请输入开标地点", trigger: "blur" }],
        evaluationTime: [{ required: true, message: "请选择评标时间", trigger: "change" }],

        preBidOpenTime: [{ required: true, message: "请选择资格预审开标时间", trigger: "change" }],
        preEvaluationTime: [{ required: true, message: "请选择资格预审评标时间", trigger: "change" }],
        // preBidOpenAddress: [{ required: true, message: "请输入资格预审开标地点", trigger: "change" }],
        // preEvaluationAddress: [{ required: true, message: "请输入资格预审评标地点", trigger: "change" }],
        // preClearAddress: [{ required: true, message: "请输入清标地点", trigger: "change" }],
        preClearTime: [{ required: true, message: "请输入清标时间", trigger: "change" }],
        evaluationAddress: [{ required: true, message: "请输入评标地点", trigger: "blur" }]
      },
      saveLoading: false,
      haveSavedFlag: false // 是否已经保存完成的标志
    };
  },
  // 监控data中的数据变化
  watch: {},
  // 生命周期 - 创建完成（可以访问当前this实例）
  async created() {
    // NODE_ENV: process.env.NODE_ENV,
    if (process.env.NODE_ENV === "development") {
      this.projectForm = this.projectForm_dev;
    }
    await this.moduleInitFn();
    await this.defaultystemCodeFn();
    // this.reserveByProjectObjOld = JSON.parse(JSON.stringify(this.projectForm.reserveByProjectObj));
    this.$nextTick(() => {
      this.projectFormOld = JSON.parse(JSON.stringify(this.projectForm));
    });
  },
  // 生命周期 - 挂载完成（可以访问DOM元素）
  mounted() {
    this.$refs["projectForm"].clearValidate();
  },
  // 生命周期 - 销毁之前
  beforeDestroy() {
    console.log("beforeDestroy");
    // this.haveSavedFlag = false;
    // this.projectForm = JSON.parse(JSON.stringify(this.projectFormOld));
  },
  // 生命周期 - 销毁完成
  destroyed() {
  },
  // 如果页面有keep-alive缓存功能，这个函数会触发
  activated() {
  },
  // 方法集合
  methods: {
    /**
     * @param type 按标段还是按项目
     * @param index? 如果是按标段, 标段的下标
     * @return {*|boolean} 是否显示按钮
     */
    isShowSelectAddressButton(type, index) {
      let remoteEvaluationFlag, homeFlag;
      if (this.projectForm.witnessForm === "PROJ") { // 按项目
        remoteEvaluationFlag = this.projectForm.reserveByProjectObj.remoteEvaluationFlag === "Y";
        homeFlag = this.projectForm.reserveByProjectObj.homeFlag === "Y";
      } else { // 按标段
        remoteEvaluationFlag = this.projectForm.reserveByBidList[index].remoteEvaluationFlag === "Y";
        homeFlag = this.projectForm.reserveByBidList[index].homeFlag === "Y";
      }
      return remoteEvaluationFlag && (type === "KB" ? homeFlag : true);
    },


    /**
     * 打开选择标室弹框
     * @param updateData 选择标室后,接受标室编号目标对象
     */
    showGZSelectAddress(updateData) {
      this.updateData = updateData;
      this.$refs["selectAddressDialog"].showSelectAddressDialog = true;
    },

    /**
     * 选择预约场地回调
     * @param id
     */
    setStandardRoomId(id) {
      const s = /(.*)\.([^.]*)$/.exec(this.updateData);
      if (s.length < 2) {
        return;
      }
      const updateObject = s[1];
      const updateKey = s[2];
      let ob = this;
      updateObject.split(".").forEach(item => {
        item && (ob = ob[item]);
      });
      this.$set(ob, updateKey, id);
    },

    tenderModeChangeFn(e) {
      console.log("e", e);
      console.log("this.projectForm.industryArr", this.projectForm.industryArr);
      console.log("this.projectForm.tenderMode", this.projectForm.tenderMode);

      // this.projectForm.qualificationExamMethod = "";

      this.TASKOBJ.industryTypeAndIndustry.forEach((item) => {
        if (item.value === this.projectForm.industryArr[0]) {
          console.log("item", item);

          item.children.forEach((itemB) => {
            if (itemB.value === this.projectForm.industryArr[1]) {
              console.log("itemB", itemB.value);
              console.log(itemB.value, this.projectForm.tenderMode);
              itemB.children.forEach((itemC) => {
                if (itemC.value === this.projectForm.tenderMode) {
                  this.qualificationExamMethods = itemC.children;
                }
              });
            }
          });
        }
      });
      let flag = this.qualificationExamMethods.some((item) => {
        return item.value === this.projectForm.qualificationExamMethod;
      });

      if (this.qualificationExamMethods.length === 1) {
        this.projectForm.qualificationExamMethod = this.qualificationExamMethods[0].value;
      } else if (this.projectForm.qualificationExamMethod !== "" && !flag) {
        this.projectForm.qualificationExamMethod = "";
      }
      // this.projectForm.industryArr
      // this.projectForm.tenderMode
    },
    // 返回方法
    handleBack() {
      // this.$router.push({ path: "/WitnessTaskManagement/WitnessTaskView" });
      this.$router.replace({ path: "/WitnessTaskManagement/WitnessTaskView" });
    },
    async moduleInitFn() {
      try {
        const res = await moduleInit({ moduleName: "CREATETASK" });
        // const res2 = await moduleInit({ moduleName: "TASK" });
        if (res.success) {
          this.TASKOBJ = res.data;
          // this.TASK2OBJ = res2.data;
          // 获取行业类别的下拉选项和依据行业类别[一级菜单---二级菜单]分组显示的交易方式
          // this.industryArrOptionsList = [];
          // this.tenderModeIndustryObj = {};
          // for (let i = 0; i < res.data.industryTypeAndIndustry.length; i++) {
          //   const ei = res.data.industryTypeAndIndustry[i];
          //   let outObj = {
          //     label: ei.label,
          //     value: ei.value,
          //     children: []
          //   };
          //   if (ei.children) {
          //     for (let j = 0; j < ei.children.length; j++) {
          //       const ej = ei.children[j];
          //       let inObj = {
          //         label: ej.label,
          //         value: ej.value
          //       };
          //       outObj.children.push(inObj);
          //       let key = ei.value + "---" + ej.value;
          //       this.tenderModeIndustryObj[key] = {};
          //       if (ej.children) {
          //         for (let k = 0; k < ej.children.length; k++) {
          //           const ek = ej.children[k];
          //           this.tenderModeIndustryObj[key][ek.value] = ek.label;
          //         }
          //       }
          //     }
          //   }
          // this.industryArrOptionsList.push(outObj);
          this.industryArrOptionsList = res.data.industryTypeAndIndustry.map((itemA) => {
            let obj = JSON.parse(JSON.stringify(itemA));
            obj.children.map((itemB) => {
              itemB.children = null;
              return itemB;
            });
            return obj;
          });
          console.log("res.data.industryTypeAndIndustry", res.data.industryTypeAndIndustry);

          // }
        } else {
          this.$message({
            type: "error",
            message: res.message || "下拉数据获取失败，请稍后刷新重试",
            single: true
          });
        }
      } catch (error) {
        console.error(error);
      }
    },
    // 行业类别发生变化，交易方式下拉选项联动
    industryArrChangeFn(arr) {
      this.tenderModeOptionsObj = {};
      console.log("arr", arr);
      // industryTypeAndTenderMode
      this.TASKOBJ.industryTypeAndIndustry.forEach((item) => {
        if (item.value === arr[0]) {
          item.children.forEach((itemB) => {
            if (itemB.value === arr[1]) {
              this.tenderModeOptionsObj = itemB.children;
            }
          });
        }
      });
      // 行业类别有值时，获取交易方式的下拉选项
      // if (arr.length === 2) {
      //   let key = arr[0] + "---" + arr[1];
      //   this.tenderModeOptionsObj = this.tenderModeIndustryObj[key];
      // }
      //
      // this.projectForm.qualificationExamMethod = "";
      // 判断交易方式之前有没有值，若有值，判断是否在上面的下拉选项之中，若不在，则清空交易方式
      console.log("this.tenderModeOptionsObj", this.tenderModeOptionsObj);
      console.log("this.tenderModeOptionsObj", this.tenderModeOptionsObj);
      let flag = this.tenderModeOptionsObj.some((item) => {
        return item.value === this.projectForm.tenderMode;
      });
      if (this.tenderModeOptionsObj.length === 1) {
        this.projectForm.tenderMode = this.tenderModeOptionsObj[0].value;
        this.tenderModeChangeFn(this.projectForm.tenderMode);
      } else if (this.projectForm.tenderMode !== "" && !flag) {
        this.projectForm.tenderMode = "";
      }
    },
    // 新增标段
    handleAddBidFn() {
      // 增加一个标段信息
      let objA = {
        bidSectionName: "",
        bidSectionCode: ""
      };
      this.projectForm.bidSectionInfoList.push(objA);
      // 按照标段预约的数组中也增加一个标段的预约信息
      let objB = JSON.parse(JSON.stringify(this.projectFormOld.reserveByProjectObj));
      this.projectForm.reserveByBidList.push(objB);
    },
    // 删除标段
    handleDelBidFn(key) {
      this.projectForm.bidSectionInfoList.splice(key, 1);
      this.projectForm.reserveByBidList.splice(key, 1);
      if (this.projectForm.bidSectionInfoList.length === 0) {
        this.projectForm.witnessForm = "PROJ";
      }
    },
    // 获取见证系统的code和name
    async defaultystemCodeFn() {
      try {
        const res = await defaultystemCode();
        if (res.success) {
          this.projectForm.sourceSystemName = res.data.sysName;
          this.projectForm.systemCode = res.data.sysCode;
        } else {
          this.$message({
            type: "error",
            message: res.message || "系统数据获取失败，请稍后刷新重试",
            single: true
          });
        }
      } catch (error) {
        console.error(error);
      }
    },
    // 保存
    handleSaveFn() {
      // let params = this.getParams2Fn();
      // console.log("params", params);
      // return;
      this.$refs["projectForm"].validate((valid) => {
        if (valid) {
          this.taskCreateFn();
        } else {
          this.$message({
            type: "warning",
            message: "请仔细检查表单，填写必填项",
            single: true
          });
        }
      });
    },
    // 新增见证任务接口
    async taskCreateFn() {
      try {
        let params = this.getParams2Fn();
        console.log("params", params);

        // return;
        this.saveLoading = true;
        this.haveSavedFlag = true;
        const res = await taskCreate(params);
        if (res.success) {
          this.$message({
            type: "success",
            message: "保存成功",
            single: true,
            onClose: () => {
              this.handleBack();
              // 重置
              this.$set(this, "projectForm", JSON.parse(JSON.stringify(this.projectFormOld)));
              this.$refs["projectForm"].clearValidate();

              this.saveLoading = false;
              this.haveSavedFlag = false;
            }
          });
        } else {
          this.$message({
            type: "error",
            message: res.message || "保存失败，请稍后再试",
            single: true
          });

          this.saveLoading = false;
          this.haveSavedFlag = false;
        }
      } catch (error) {
        console.error(error);
        this.$message({
          type: "error",
          message: "保存失败，请稍后再试",
          single: true
        });
        this.saveLoading = false;
        this.haveSavedFlag = false;
      }
    },
    // 标段数据格式化
    formDataFormatFn(formData, reserveByProjectObj, index) {
      // :prop="`bidSectionInfoList.${key}.bidSectionCode`"
      // 标段list
      let newBidSectionObj = {
        bidSectionCode: formData.projectCode,
        bidSectionName: formData.projectName,
        tenderAgainFlag: reserveByProjectObj.tenderAgainFlag,
        overNightFlag: reserveByProjectObj.overNightFlag,
        remoteOpenFlag: reserveByProjectObj.remoteOpenFlag,
        remoteEvaluationFlag: reserveByProjectObj.remoteEvaluationFlag,

        preClearFlag: reserveByProjectObj.preClearFlag,
        sourceObjectId: reserveByProjectObj.sourceObjectId
      };

      // 是否远程异地
      if (reserveByProjectObj.remoteEvaluationFlag === "Y") {
        newBidSectionObj.homeFlag = reserveByProjectObj.homeFlag;
        newBidSectionObj.remoteOriginator = reserveByProjectObj.remoteOriginator;
        newBidSectionObj.remoteUserName = reserveByProjectObj.remoteUserName;
        newBidSectionObj.remoteContact = reserveByProjectObj.remoteContact;
      }
      // 时间list
      let newReserveObj = {
        bidSectionName: reserveByProjectObj.bidSectionName || formData.projectCode,
        bidSectionCode: reserveByProjectObj.bidSectionCode || formData.projectCode,
        openStartTime: reserveByProjectObj.openTime[0],
        openEndTime: reserveByProjectObj.openTime[1],
        openAddress: reserveByProjectObj.openAddress,
        evaluationStartTime: reserveByProjectObj.evaluationTime[0],
        evaluationEndTime: reserveByProjectObj.evaluationTime[1],
        evaluationAddress: reserveByProjectObj.evaluationAddress
      };
      // 有标段
      if (index > -1) {
        newBidSectionObj.bidSectionCode = formData.bidSectionInfoList[index].bidSectionCode;
        newBidSectionObj.bidSectionName = formData.bidSectionInfoList[index].bidSectionName;
        newReserveObj.bidSectionCode = formData.bidSectionInfoList[index].bidSectionCode;
        newReserveObj.bidSectionName = formData.bidSectionInfoList[index].bidSectionName;
      }
      // 资格预审
      if (formData.qualificationExamMethod === "PRE_QUALIFICATION") {
        newReserveObj.preBidOpenAddress = reserveByProjectObj.preBidOpenAddress;
        if (reserveByProjectObj.preBidOpenTime && reserveByProjectObj.preBidOpenTime.length > 0) {
          newReserveObj.preBidOpenStartTime = reserveByProjectObj.preBidOpenTime[0];
          newReserveObj.preBidOpenEndTime = reserveByProjectObj.preBidOpenTime[1];
        }
        if (reserveByProjectObj.preEvaluationTime && reserveByProjectObj.preEvaluationTime.length > 0) {
          newReserveObj.preEvaluationStartTime = reserveByProjectObj.preEvaluationTime[0];
          newReserveObj.preEvaluationEndTime = reserveByProjectObj.preEvaluationTime[1];
        }
      }
      // 清标
      if (reserveByProjectObj.preClearFlag === "Y") {
        newReserveObj.preClearAddress = reserveByProjectObj.preClearAddress;

        if (reserveByProjectObj.preClearTime) {
          newReserveObj.preClearStartTime = reserveByProjectObj.preClearTime[0];
          newReserveObj.preClearEndTime = reserveByProjectObj.preClearTime[1];
        }
      }
      return { newBidSectionObj, newReserveObj };
    },
    // 获取新增见证任务的参数
    getParams2Fn() {
      let bidSectionInfoList = [];
      let projectTimeInfoList = [];
      let formData = this.$cafeUtils.deepClone(this.projectForm);
      let params = {
        bidSectionInfoList: [],
        projectTimeInfoList: []
      };
      console.log("formData", formData);

      // 1. 补充需要的属性
      params.industryType = formData.industryArr[0];
      params.industry = formData.industryArr[1];
      /*
  a. 判断该项目下是否包含标段，若不包含标段，则将项目信息当做标段信息预约。
  b. 若包含标段：判断预约是否区分标段，若不区分，该项目所有的标段共用预约信息数组；若区分，每个标段都有自己的预约信息。
*/
      // params.projectTimeInfoList = []; // 标段预约信息列表
      console.log("formData.witnessForm", formData.witnessForm);
      console.log("formData.bidSectionInfoList", formData.bidSectionInfoList);
      // 按项目预约
      if (formData.witnessForm === "PROJ") {
        // 新增标段为空，
        if (formData.bidSectionInfoList.length === 0) {
          // 标段list
          let { newBidSectionObj, newReserveObj } = this.formDataFormatFn(formData, formData.reserveByProjectObj);
          bidSectionInfoList.push(newBidSectionObj);
          projectTimeInfoList.push(newReserveObj);
        } else {
          formData.bidSectionInfoList.forEach((item, index) => {
            console.log("bidSectionInfoList", item);

            let obj = Object.assign({}, formData.reserveByProjectObj, item);
            let { newBidSectionObj, newReserveObj } = this.formDataFormatFn(formData, obj, index);
            bidSectionInfoList.push(newBidSectionObj);
            projectTimeInfoList.push(newReserveObj);
          });
        }
      } else {
        // 按标段预约
        formData.reserveByBidList.forEach((item, index) => {
          console.log("index", index);
          console.log("item", item);

          let { newBidSectionObj, newReserveObj } = this.formDataFormatFn(formData, item, index);
          bidSectionInfoList.push(newBidSectionObj);
          projectTimeInfoList.push(newReserveObj);
        });
      }
      // if (formData.bidSectionInfoList.length === 0 || formData.witnessForm === "PROJ") {
      // } else {
      //   console.log("11");

      //   // formData.reserveByBidList.forEach((item, index) => {
      //   //   console.log("index", index);
      //   //   console.log("item", item);

      //   //   let { newBidSectionObj, newReserveObj } = this.formDataFormatFn(formData, item, index);
      //   //   bidSectionInfoList.push(newBidSectionObj);
      //   //   projectTimeInfoList.push(newReserveObj);
      //   // });
      // }
      params.bidSectionInfoList = bidSectionInfoList;
      params.projectTimeInfoList = projectTimeInfoList;
      let paramsObj = Object.assign({}, formData, params);
      // 2. 删除不需要的属性
      this.$delete(paramsObj, "sourceSystemName");
      this.$delete(paramsObj, "industryArr");
      this.$delete(paramsObj, "preBidOpenTime");
      this.$delete(paramsObj, "preEvaluationTime");
      this.$delete(paramsObj, "reserveByBidSectionFlag");
      this.$delete(paramsObj, "reserveByProjectObj");
      this.$delete(paramsObj, "reserveByBidList");
      return paramsObj;
    }
  }
};
</script>
<style lang="scss" scoped>
.bid-content {
  margin: 10px 10px 0 10px;
  padding-top: 10px;

  .el-col {
    padding-top: 10px;
    margin-bottom: 10px;
    background-color: rgba(216, 216, 216, 0.16) !important;
    border: 1px dashed #e9e5e5;

    &:nth-child(odd) {
      border-right: 0;
    }

    &:nth-child(even) {
      border-left: 0;
    }
  }

  .bid-code {
    padding-right: 30px !important;
    position: relative;

    .del-bid {
      position: absolute;
      // top: 20px;
      right: -20px;
    }
  }
}

.select-address-button {
  color: #fff !important;
  background-color: #1890ff !important;
  border-color: #1890ff !important;
}
</style>
